﻿using System;
using System.Data;
using System.Configuration;
using System.ComponentModel;
using System.Reflection;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace Data.DataSources {
	public class DummyDataSource : ObjectDataSourceBase {
		public string ColumnName { set { SetSelectParameter("ColumnName", value); } }
		public string ColumnValue { set { SetSelectParameter("ColumnValue", value); } }

		public override DataView SelectEx() { throw new NotImplementedException(MethodBase.GetCurrentMethod().Name); }
		
		public DataView SelectEx(string ColumnName) { return GetTable(ColumnName,null); }
		
		public DataView SelectEx(string ColumnName,object ColumnValue) { return GetTable(ColumnName,ColumnValue); }
		
		private DataView GetTable(string ColumnName, object ColumnValue) {
			if (ColumnName == "") throw new ArgumentException("ColumnName parameter must not be empty.");
			DataTable dt = new DataSet().Tables.Add();
			dt.Columns.Add(ColumnName,typeof(object));
			dt.Rows.Add(ColumnValue);
			return dt.DefaultView;
		}
	}
}